<template>
  <div id="app">
    <van-nav-bar :title="title"
                 left-text="返回"
                 left-arrow
                 @click-left="onClickLeft" />
    <!-- 中间切换的组件 -->
    <router-view></router-view>

    <van-tabbar v-model="active">
      <van-tabbar-item icon="music-o"
                       to="/home"></van-tabbar-item>
      <van-tabbar-item icon="chart-trending-o"
                       to="/leaderboard"></van-tabbar-item>
      <van-tabbar-item icon="tv-o"
                       badge="6"
                       to="/video"></van-tabbar-item>
      <van-tabbar-item icon="friends-o"
                       to="/singer"></van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data: () => ({
    active: 0,
    title: "首页",
  }),
  methods: {
    onClickLeft () {
      this.$router.go(-1);
    },
  },
};
</script>

<style>
#app {
  font-size: 16px;
}
</style>
